想用jquery代码实现这样的一个功能:有一个下拉框,当选择下拉框的时候,判断选择的值有没有被选择过,如果有则提示;代码如下:
$(function(){
var authTypes=new Array();
authTypes = $("#authTypes").val().split(',');
$("#authType").on("change",function(){
console.log(authTypes)
console.log("当前选择的" + $('#authType option:selected').val())
for(var val in authTypes){
console.log(val)
if($('#authType option:selected').val() == authTypes[val]){
console.log(val+" selected:" + $('#authType option:selected').val())
alert("该分类已添加过");
return false;
}
}
/* if(checkArray.indexOf($('#authType option:selected').val()) |